function executor(resolve,reject){
    console.log("开始异步任务");
    //执行成功
    setTimeout(function(){
        resolve("success"); 
        //reject("fail")

    },2000);
}

function resolveHandle(result){
    console.log(`执行成功,结果是:${result}`);
}
function rejectHandle(error){
    console.log(`执行失败,错误是${error}`)
}
const promise = new Promise(executor);
promise.then(resolveHandle,rejectHandle)